<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" >

<title>GAMES101环境配置记录 wsl+ubuntu22.04+vscode+VcXsrv | 泥烟</title>

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link rel="shortcut icon" href="https://knight-02.gitee.io/favicon.ico?v=1715914391071">
<link rel="stylesheet" href="https://knight-02.gitee.io/styles/main.css">



<link rel="stylesheet" href="https://unpkg.com/aos@next/dist/aos.css" />
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>



    <meta name="description" content="安装 wsl, g++, eigen, cmake
略
配置opencv
[root@DESKTOP-31LJ6LM ~/g101/h1/build]
$ cmake ..
-- OpenCV ARCH:
-- OpenCV RUNTIME..." />
    <meta name="keywords" content="图形学" />
  </head>
  <body>
    <div id="app" class="main">

      <div class="sidebar" :class="{ 'full-height': menuVisible }">
  <div class="top-container" data-aos="fade-right">
    <div class="top-header-container">
      <a class="site-title-container" href="https://knight-02.gitee.io">
        <img src="https://knight-02.gitee.io/images/avatar.png?v=1715914391071" class="site-logo">
        <h1 class="site-title">泥烟</h1>
      </a>
      <div class="menu-btn" @click="menuVisible = !menuVisible">
        <div class="line"></div>
      </div>
    </div>
    <div>
      
        
          <a href="/" class="site-nav">
            首页
          </a>
        
      
        
          <a href="/archives" class="site-nav">
            归档
          </a>
        
      
        
          <a href="/tags" class="site-nav">
            标签
          </a>
        
      
        
          <a href="https://knight-02.gitee.io/post/knight02-first-blog-here-for-test" class="site-nav">
            关于
          </a>
        
      
        
          <a href="/links" class="site-nav">
            友链
          </a>
        
      
    </div>
  </div>
  <div class="bottom-container" data-aos="flip-up" data-aos-offset="0">
    <div class="social-container">
      
        
      
        
      
        
      
        
      
        
      
    </div>
    <div class="site-description">
      两岸猿声啼不住， 轻舟已过万重山
    </div>
    <div class="site-footer">
      Powered by <a href="https://github.com/getgridea/gridea" target="_blank">Gridea</a> | <a class="rss" href="https://knight-02.gitee.io/atom.xml" target="_blank">RSS</a>
    </div>
  </div>
</div>


      <div class="main-container">
        <div class="content-container" data-aos="fade-up">
          <div class="post-detail">
            <h2 class="post-title">GAMES101环境配置记录 wsl+ubuntu22.04+vscode+VcXsrv</h2>
            <div class="post-date">2023-12-27</div>
            
              <div class="feature-container" style="background-image: url('https://knight-02.gitee.io/post-images/games101-huan-jing-pei-zhi-ji-lu-wslubuntu2204vscodevcxsrv.png')">
              </div>
            
            <div class="post-content" v-pre>
              <h1 id="安装-wsl-g-eigen-cmake">安装 wsl, g++, eigen, cmake</h1>
<p>略</p>
<h1 id="配置opencv">配置opencv</h1>
<pre><code>[root@DESKTOP-31LJ6LM ~/g101/h1/build]
$ cmake ..
-- OpenCV ARCH:
-- OpenCV RUNTIME:
-- OpenCV STATIC: OFF
CMake Warning at /mnt/e/DevelopeTools/opencv/opencv/build/OpenCVConfig.cmake:190 (message):
  Found OpenCV Windows Pack but it has no binaries compatible with your
  configuration.

  You should manually point CMake variable OpenCV_DIR to your build of OpenCV
  library.
Call Stack (most recent call first):
  CMakeLists.txt:4 (find_package)


CMake Error at CMakeLists.txt:4 (find_package):
  Found package configuration file:

    /mnt/e/DevelopeTools/opencv/opencv/build/OpenCVConfig.cmake

  but it set OpenCV_FOUND to FALSE so package &quot;OpenCV&quot; is considered to be
  NOT FOUND.


-- Configuring incomplete, errors occurred!
See also &quot;/root/g101/h1/build/CMakeFiles/CMakeOutput.log&quot;.
</code></pre>
<p>捣鼓了大半天,总算在(wsl)ubuntu 22.04上配好了opencv开发环境<br>
参考,包括但不限于:<br>
https://blog.csdn.net/weixin_52402390/article/details/122341561<br>
https://blog.csdn.net/Undefinedefity/article/details/106180033</p>
<p>其中,在make -j时, 我出现了缺openjpeg.h头文件的错误,导致make: *** [Makefile:****] 错误 2<br>
<img src="https://knight-02.gitee.io/post-images/2138326-20220929084855690-1179844682.png" alt="" loading="lazy"><br>
解决方案:<br>
https://github.com/uclouvain/openjpeg/blob/master/INSTALL.md</p>
<p><code>在补好缺的依赖后一定把之前opencv build的删掉,重新cmake,make一遍</code></p>
<h1 id="wsl-xfce4-连接-windows-vcxsrv">wsl xfce4 连接 windows VcXsrv</h1>
<p>参考:https://www.bilibili.com/video/BV1RK411n79v</p>
<h2 id="1配置">1.配置</h2>
<pre><code>sudo vim /etc/resolv.conf
</code></pre>
<p>记住其中的IP</p>
<pre><code>sudo vim ~/.bashrc
</code></pre>
<p>加入如下两行,此处打码部分即为上方的IP<br>
<img src="https://knight-02.gitee.io/post-images/2138326-20220928164600941-396411656.png" alt="" loading="lazy"></p>
<h2 id="2启动vcxsrv">2.启动VcXsrv</h2>
<p><img src="https://knight-02.gitee.io/post-images/2138326-20220928164149985-1426777213.png" alt="" loading="lazy"><br>
<img src="https://knight-02.gitee.io/post-images/2138326-20220928164220971-1078493992.png" alt="" loading="lazy"><br>
<img src="https://knight-02.gitee.io/post-images/2138326-20220928164252439-1515712422.png" alt="" loading="lazy"></p>
<h2 id="3wsl输入-startxfce4">3.wsl输入 startxfce4</h2>
<figure data-type="image" tabindex="1"><img src="https://knight-02.gitee.io/post-images/2138326-20220928172236434-452179245.png" alt="" loading="lazy"></figure>

            </div>
            
              <div class="tag-container">
                
                  <a href="https://knight-02.gitee.io/tag/CG/" class="tag">
                    图形学
                  </a>
                
              </div>
            
            
              <div class="next-post">
                <div class="next">下一篇</div>
                <a href="https://knight-02.gitee.io/post/knight02-first-blog-here-for-test/">
                  <h3 class="post-title">
                    knight02 first blog here for test
                  </h3>
                </a>
              </div>
            

            

          </div>

        </div>
      </div>
    </div>

    <script src="https://unpkg.com/aos@next/dist/aos.js"></script>
<script type="application/javascript">

AOS.init();

var app = new Vue({
  el: '#app',
  data: {
    menuVisible: false,
  },
})

</script>


  <script src="//cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.5.1/build/highlight.min.js"></script>
  <script>
    hljs.initHighlightingOnLoad()
  </script>





  </body>
</html>
